package com.android.gtravelling;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;

import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class DeleteActivity extends Activity {

	private DBAdapter mDB;
	private String _name = "";

	@Override
	public void onCreate(Bundle ds) {
		super.onCreate(ds);
		//setContentView(R.layout.new_edit_contact);

		mDB = new DBAdapter(this);
		mDB.open();

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			// Get data via the key
			// String value1 = extras.getString(Intent.EXTRA_TEXT);
			ArrayList<String> lstName = new ArrayList<String>();
			lstName = extras.getStringArrayList("listNameDel");

			// this._name=value1;
			if (lstName != null) {
				for (int i = 0; i < lstName.size(); i++) {
					mDB.deleteUser(lstName.get(i));
				}
				
				Intent i=new Intent(this, GTravellingActivity.class);
				startActivity(i);
			}
		}
	}
	public void displayAMessage(String msg) {

		AlertDialog alertDialog;
		alertDialog = new AlertDialog.Builder(this).create();
		alertDialog.setTitle("Message");
		alertDialog.setMessage(msg);

		alertDialog.show();
	}
}
